package test01;


class PP implements Cloneable {
    public int i = 32;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}


class Money implements Cloneable {
    public String money = "666";
    public PP pp = new PP();

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Money money1 = (Money) super.clone();
        money1.pp = (PP) this.pp.clone();
        return money1;
        // return super.clone();
    }
}

class person implements Cloneable {
    public int age = 10;
    public Money m = new Money();

    @Override
    protected Object clone() throws CloneNotSupportedException {
        person per = (person) super.clone();
        per.m = (Money) this.m.clone();
        return per;
        //return super.clone();
    }

    @Override
    public String toString() {
        return "person{" +
                "age=" + age +
                '}';
    }
}

public class my {
    public static void main(String[] args) throws CloneNotSupportedException {
        person person = new person();
        person person1 = (person) person.clone();
        person1.m.money = "888";
        person1.m.pp.i = 23;
        System.out.println(person.m.money);
        System.out.println(person1.m.money);
    }
}